package com.jy.modules.cims.component.balance.servicefee.impl;

import java.math.BigDecimal;

import com.jy.modules.cims.component.balance.servicefee.BaseServiceFee;
import com.jy.modules.cims.data.common.dto.TCMmCostParamDTO;
import com.jy.modules.cims.data.dto.CreditDetailDto;

public class WC extends BaseServiceFee{

	public BigDecimal doServiceFee(CreditDetailDto creditDetailDto,
			TCMmCostParamDTO tcmmCostParamDto) {
		//服务费基数
		BigDecimal baseAmount = super.getBaseServiceFee(creditDetailDto, tcmmCostParamDto.getServiceFeeBase());
		
		BigDecimal feeRate = tcmmCostParamDto.getServiceFeeRatio();//服务费率
		BigDecimal packageRate = tcmmCostParamDto.getPackageRatio(); //打包价
		//剩余本金*服务费率/(1+打包价)
		return baseAmount.multiply(feeRate).divide(packageRate.add(new BigDecimal(1)));
	}

	public BigDecimal doGuaranteeFee(CreditDetailDto creditDetailDto,
			TCMmCostParamDTO tcmmCostParamDto) {

		//获取担保费基数
		BigDecimal baseAmount = super.getBaseBondFee(creditDetailDto, tcmmCostParamDto.getGuaranteeFeeBase());
		//获取担保费率
		BigDecimal bondRate = tcmmCostParamDto.getGuaranteeFeeRatio();
		return baseAmount.multiply(bondRate);
	}

	public BigDecimal doRiskFee(CreditDetailDto creditDetailDto,
			TCMmCostParamDTO tcmmCostParamDto) {
		//风险金基数
		BigDecimal baseAmount = super.getBaseRiskFee(creditDetailDto, tcmmCostParamDto.getMarginBase());
		//风险金比例
		BigDecimal RiskRate = tcmmCostParamDto.getMarginRatio();
		return baseAmount.multiply(RiskRate);
	}

}
